// Copyright 2022 Tencent
#pragma once
#include "util/condition.h"
namespace net_tools::util
{

  class Count_down_cond : util::noncopyable
  {
  public:
    Count_down_cond(int);
    ~Count_down_cond() = default;
    void Set_count(int count);
    void Add_count(int count);
    void Wait();
    void Signal();

  private:
    mutable Mutex mutex_;
    Condition cond_;
    int count_;
  };

} // namespace net_tools::util